import 'package:json_annotation/json_annotation.dart';

import '../../../util/DateUtil.dart';
import 'Dto.dart';

part 'Req.g.dart';

class Req extends Dto {

  DateTime? createDateTime;      // 消息发送成功时间
  String? localSeq;

  Req({this.localSeq}):
    this.createDateTime = DateTime.now();

  @override
  String? getLocalSeq() {
    return localSeq;
  }
}

class ServerReq extends Req {

}

@JsonSerializable()
class OkReq extends Req {
  final int coder;
  String? otherInfo;

  OkReq({required this.coder, this.otherInfo});

  factory OkReq.fromJson(Map<String, dynamic> json) => _$OkReqFromJson(json);

  Map<String, dynamic> toJson() => _$OkReqToJson(this);
}

@JsonSerializable()
class OkListReq extends OkReq {
  Set<String> localSeqSet;

  OkListReq({required this.localSeqSet, required super.coder, super.otherInfo});

  factory OkListReq.fromJson(Map<String, dynamic> json) => _$OkListReqFromJson(json);

  Map<String, dynamic> toJson() => _$OkListReqToJson(this);
}

class TenantReq extends Req {
  String tenantCode;    // 租户code
  String terminalType;  // 终端编制  TerminalType

  TenantReq({required this.tenantCode, required this.terminalType});
}